<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="pragma" content="no-cache" />
        <meta http-equiv="cache-control" content="no-cache" />
        <meta http-equiv="expires" content="0" />
        <title></title>
        <link rel="stylesheet" rev="stylesheet" href="{{$http_url}}/css/style.css" type="text/css" media="all" />
    </head>

    <body class="ContentBody">
        <form action="{{$http_url}}/managing/addUser/" method="post"  name="form" >
            <div class="MainDiv">
                <table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent">
                    <tr>
                        <th class="tablestyle_title" >添加新用户</th>
                    </tr>
                    <tr>
                        <td class="CPanel">
                            <table border="0" cellpadding="0" cellspacing="0" style="width:100%">
                                <tr>
                                    <td width="100%">
                                        <fieldset style="height:100%;">
                                            <legend>员工信息</legend>
                                            <table border="0" cellpadding="2" cellspacing="1" style="width:100%">
                                                <tr>
                                                    <td nowrap align="right" width="15%">IC卡号:</td>
                                                    <td width="35%"><input name='txtaudit' id="txtaudit" type="text" class="text" style="width:154px"  /></td>
                                                </tr>
                                                <tr>
                                                    <td nowrap align="right" width="15%">用户名:</td>
                                                    <td width="35%"><input id="txtusername" name='txtusername' type="text" class="text" style="width:154px" />
                                                        <span class="red">*</span></td>
                                                </tr>
                                                <tr>
                                                    <td nowrap align="right" width="15%">真实姓名:</td>
                                                    <td width="35%"><input name='nickname' type="text" class="text" style="width:154px" /></td>
                                                </tr>
                                                <tr>
                                                    <td nowrap align="right" width="15%">密码:</td>
                                                    <td width="35%"><input id="txtpassword" name='txtpassword' type="password" class="text" style="width:154px" onpaste="return false" />
                                                        <span class="red">*{{$pwdTxt.txt}},{{$pwdTxt.length}}位</span></td>
                                                </tr>
                                                <tr>
                                                    <td nowrap align="right" width="15%">确认密码:</td>
                                                    <td width="35%"><input id="txtpassword_confirm" name='txtpassword_confirm' type="password" class="text" style="width:154px"  onpaste="return false" />
                                                        <span class="red">*</span></td>
                                                </tr>
                                                <tr>
                                                    <td nowrap align="right" width="15%">邮箱:</td>
                                                    <td width="35%"><input name='txtemail' type="text" class="text" style="width:154px"  /></td>
                                                </tr>
                                                <tr>
                                                    <td nowrap align="right" width="15%">电话:</td>
                                                    <td width="35%"><input name='txtmobile' type="text" class="text" style="width:154px"  /></td>
                                                </tr>
                                                <tr>
                                                    <td nowrap align="right" width="15%">IP地址:</td>
                                                    <td width="35%"><input name='ip_adress' type="text" class="text" style="width:154px" /></td>
                                                </tr>
                                                <tr>
                                                    <td nowrap align="right" width="15%">所属部门:</td>
                                                    <td width="35%">
                                                        <select name="department" id="select">
                                                            <option value="" >------------</option>
                                                            {{foreach from=$dep_data item=list}}
                                                            <option value="{{$list.id}}" >{{$list.nickname}}</option>
                                                            {{/foreach}}
                                                        </select>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td nowrap align="right" width="15%">密级:</td>
                                                    <td width="35%">
                                                        <select name="level" id="level">
                                                            <option value="" >------------</option>
                                                            {{foreach from=$userlevel item=val_root key=key}}
                                                            <option value={{$key}} >{{$val_root}}</option>
                                                            {{/foreach}}
                                                        </select>

                                                    </td>
                                                </tr>
                                                <br>
                                            </table>
                                            <br />
                                        </fieldset></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center" height="50px">
                            <input id="submit" type="submit" name="submit" value="保存" class="button" />
                        </td>
                    </tr>
                </table>
            </div>
        </form>
        <script type="text/javascript" src="{{$http_url}}/js/jquery.min.js"></script>
        <script type="text/javascript" src="{{$http_url}}/js/authentication.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $("#submit").click(function(){
                    var pattern = /^[a-zA-Z0-9]{8}$/;
                    var audit=$("#txtaudit").val();
                    if(!pattern.test(audit)){
                        alert("请输入8位由字符与数字组成的卡号!");
                        return false;
                    }
                    if(authentication.isEmpty($("#txtusername").val())){
                        alert("请输入用户名!");
                        return false;
                    }
                    if (/[\u4E00-\u9FA5]/i.test($("#txtusername").val())) {
                        alert('用户名请勿输入中文!');
                        return false;
                    }
                    var pwd=$("#txtpassword").val();
                    if(authentication.isEmpty(pwd)){
                        alert("请输入密码!");
                        return false;
                    }
                    if($("#txtpassword").val() !=$("#txtpassword_confirm").val()){
                        alert("确认密码与密码不同,请重新输入!");
                        return false;
                    }
                    if(authentication.isEmpty($("#select").val())){
                        alert("请选择用户所属部门!");
                        return false;
                    }
                    if(authentication.isEmpty($("#level").val())){
                        alert("请选择用户保密级别!");
                        return false;
                    }
                });
            })
        </script>
    </body>
</html>
